#ifndef accountmanager_utils_category_h
#define accountmanager_utils_category_h

#include <utils/utils_decl.h>

#include <utils/core/string.h>
#include <utils/core/set.h>

namespace AccountManagerUtils {
	
//! Information about a category of items
/*!
 *  An item category is uniquely identified by its name. It also holds an optional description of the category.
 */
class _accountmanager_utils_decl Category {

public:
	Category();
	Category(const Category& rhs);
	Category(const String& name);
	Category(const String& name, const String& description);
	~Category();
	Category& operator=(const Category& rhs);

	bool operator==(const Category& rhs) const;
	bool operator!=(const Category& rhs) const;
	
	String& name();
	const String& name() const;
	String& description();
	const String& description() const;

private:
	String name_;
	String description_;
};

inline uint qHash(const Category& category) {
	return qHash(category.name());
}

//===========================================================

//! Library of all categories available on the current session
class _accountmanager_utils_decl CategoryLib {

public:
	static const Category* find_category(const String& name);
	static const Set<Category>& categories();
	
	~CategoryLib();

private:
	CategoryLib();

	static CategoryLib* instance();

private:
	Set<Category> categories_;
	static CategoryLib* instance_;
};

} // namespace AccountManagerUtils

#endif
